﻿
<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
    <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#datagrid-code')}">
        <fieldset>
            <legend style="font-weight:normal;">搜索：</legend>
            <div style="margin:0; padding:1px 5px 5px;">
                <span>菜单名：</span>
                <input type="text" name="k" class="form-control" size="15">

                <div class="btn-group">
                    <button type="submit" class="btn-green" data-icon="search">开始搜索！</button>
                    <button type="reset" class="btn-orange" data-icon="times">重置</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<div class="bjui-pageContent">
    <table class="table table-bordered" id="datagrid-code"></table>
</div>

<script type="text/javascript">
    $.CurrentNavtab.find('#datagrid-code').datagrid({
        height: '100%',
        tableWidth: '100%',
        gridTitle: '菜单管理',
        showToolbar: true,
        showCheckboxcol: true,
        filterThead: false,
        toolbarItem: '@Html.ToolbarItems("Sys.Menu.Index")',
        toolbarCustom: '@Html.ToolbarCustom("Sys.Menu.Index")',
        exportOption: { type: 'file', options: { url: '/Sys/Menu/Export' } },
        dataUrl: '/sys/Menu/indexajax',
        editUrl: '/sys/Menu/edit?id={menu_id}',
        delUrl: '/sys/Menu/Delete',
        editMode: {
            dialog: {
                width: '800', height: 500,
                mask: true,
                title: '编辑菜单'
            }
        },
        okCallback: function (json) {
            console.log(json);
        },
        delPK: 'menu_id',
        isTree: "name",
        treeOptions: {
            expandAll: false,
            add: false,
            simpleData: true,
            keys: {
                key: 'menu_id',        // id
                parentKey: 'parent_id'       // 父id  
            }
        },
        columns: [
            {
                name: 'name',
                label: '菜单名',
                align: 'conter',
                width: 150
            } , {
                name: 'permission',
                label: '权限标识',
                align: 'center',
                width: 70
            }, {
                name: 'menu_position',
                label: '菜单位置',
                align: 'center',
                render: function (value, data) {
                    if (value == "0") {
                        return "后台菜单";
                    } else if (value == "1") {
                        return "经销商菜单";
                    } else if (value == "2") {
                        return "店面菜单";
                    }
                    return value;
                }
            }, {
                name: 'menu_type',
                label: '菜单类型',
                align: 'center',
                render: function (value, data) {
                    if (value == "0") {
                        return "菜单类型";
                    } else if (value == "1") {
                        return "按钮";
                    } 
                    return value;
                }
            }, {
                name: 'js_method',
                label: '按钮Js方法',
                align: 'center'
            }, {
                name: 'iconCls',
                label: '图标',
                align: 'center' 
            }, {
                name: 'url',
                label: '链接',
                align: 'center'
            }, {
                name: 'orderNum',
                label: '排序',
                align: 'center'
            }
        ],
        linenumberAll: true
    })
</script> 